package com.jxin.mall.weixin.service.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * 微信公总号聊天窗服务接口
 * @author 蔡佳新
 * @version 1.0
 * @since jdk 1.8
 */
@Api(tags = "微信公总号聊天窗服务接口")
@RequestMapping("/wx/portal")
public interface WxPortalService {

    @GetMapping(value = "/{appid}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "适配公众号接口", response = String.class)
    String authGet(@ApiParam(value = "appid", required = true) @PathVariable String appid,
                   @ApiParam(value = "签名") @RequestParam(name = "signature", required = false) String signature,
                   @ApiParam(value = "时间截") @RequestParam(name = "timestamp", required = false) String timestamp,
                   @ApiParam(value = "nonce") @RequestParam(name = "nonce", required = false) String nonce,
                   @ApiParam(value = "echostr") @RequestParam(name = "echostr", required = false) String echostr);
    @PostMapping(value = "/{appid}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "公众号消息推送接口", response = String.class)
    String post(@ApiParam(value = "appid", required = true) @PathVariable String appid,
                @ApiParam(value = "请求正文", required = true) @RequestBody String requestBody,
                @ApiParam(value = "签名", required = true) @RequestParam("signature") String signature,
                @ApiParam(value = "时间截", required = true)  @RequestParam("timestamp") String timestamp,
                @ApiParam(value = "nonce", required = true) @RequestParam("nonce") String nonce,
                @ApiParam(value = "openid", required = true) @RequestParam("openid") String openid,
                @ApiParam(value = "encrypt_type") @RequestParam(name = "encrypt_type", required = false) String encType,
                @ApiParam(value = "msg_signature") @RequestParam(name = "msg_signature", required = false) String msgSignature);
}
